<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			var findMaxConsecutiveOnes = function(nums) {
			    let maxCount = 0, count = 0;
			    const n = nums.length;
			    for (let i = 0; i < n; i++) {
			        if (nums[i] === 1) {
			            count++;
			        } else {
			            maxCount = Math.max(maxCount, count);
			            count = 0;
			        }
			    }
			    maxCount = Math.max(maxCount, count);
			    return maxCount;
			};
			console.log(findMaxConsecutiveOnes([1,1,0,1,1,1]));
		</script>
	</body>
</html>
